
function y = difSVD(w,P,X,Z,R,C)

PZZ = calculatePHat(w,X,Z,R,C);

y = 0;

for ii=1:R
    for jj=1:C 
        
        y = y + myfunc(ii,jj,P,PZZ);        
            
    end
end

end



function v = myfunc(ii,jj,P,PZ)

p = P(ii,jj);
pHat = PZ(ii,jj);
v = mean(svd(pHat)) -mean(svd(p));

end

